/* eslint-disable @typescript-eslint/no-use-before-define */
import { PageContainer } from '@ant-design/pro-components';
import { Access, useAccess } from '@umijs/max';
import { Button, notification } from 'antd';

const PoteCust: React.FC = () => {
  const [api, contextHolder] = notification.useNotification();
  const access = useAccess();
  return (
    <PageContainer
      ghost
      header={{
        title: '权限示例',
      }}
    >
      <Access accessible={access.canSeeAdmin}>
        {contextHolder}
        <Button type="primary" onClick={() => handleCliek('这是一个测试')}>
          click me
        </Button>
      </Access>
    </PageContainer>
  );
  function handleCliek(item: string) {
    api.open({
      message: '点击了',
      description: item,
      duration: 0,
    });
  }
};

export default PoteCust;
